<?php

namespace App\Containers\AppSection\Data\Data\Repositories;

use App\Containers\AppSection\Data\Models\Company;
use App\Ship\Parents\Repositories\Repository;

class CompanyRepository extends Repository
{
    /**
     * @var array
     */
    protected $fieldSearchable = [
        'id' => '=',
        // ...
    ];

    public function check(int $id): bool
    {
        /** @var Company $entity */
        $entity = $this->find($id);

        if ($entity->address_matches != true && empty($entity->actual_address))
            return true;

        return empty($entity->name) ||
            empty($entity->ogrn) ||
            empty($entity->inn) ||
            empty($entity->legal_address) ||
            empty($entity->actual_address);
    }
}
